﻿using System;
using System.Collections.Generic;
using System.Text;

namespace HR60_PanelSoft.View.Base
{
    //GC: 增加了IComparable接口，实现排序功能
    //



	/// <summary>
	/// 选项对象，作为ComboBox等控件数据绑定的中介
	/// </summary>
	public class SelectItem : IComparable<SelectItem>   
	{
		// 显示内容
		private string _text;

		// 数据内容
		private object _value;

		public string text
		{
			get { return _text; }
			set { this._text = value; }
		}

		public object value
		{
			get { return _value; }
			set { this._value = value; }
		}

		public SelectItem(string text, object value)
		{
			this._text = text;
			this._value = value;
		}

        /// <summary>
        /// 
        /// </summary>
        /// <param name="other"></param>
        /// <returns>小于0，则小，大于0则大，等于0则，相等</returns>
        public int CompareTo(SelectItem other)
        {
            if (null == other)
                return -1; /* 当为空时，最小 */

            return this.text.CompareTo(other.text);

        }
	}
}
